﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

namespace PhysicsSimulator
{
    #region Player weapon enum definitions
    public enum WeaponType
    {
        Normal,
        Split
    }
    #endregion

    internal class Player : CGameObject
    {
        #region Variables/Fields        
      

        // Constants used for calculating shot strength
        public const float MinShotVelocity = 200f;
        public const float MaxShotVelocity = 665f;
        public const float MinShotAngle = 0; // 0 degrees
        public const float MaxShotAngle = 1.3962634f; // 80 degrees

        // Public variables used by Gameplay class
        public Catapult Catapult { get; set; }
        public int Score { get; set; }
        public string Name { get; set; }
        public int Health { get; set; }

        public Player Enemy
        {
            set
            {
                Catapult.Enemy = value;
                Catapult.Self = this;
            }
        }

        public bool IsActive { get; set; }

        public WeaponType Weapon { get; set; }
        #endregion

        #region Initialization
        public Player(SpriteBatch spriteBatch)
            : base(spriteBatch)
        {
           
        }


        public override void Init(Microsoft.Xna.Framework.Content.ContentManager contentManager)
        {
 	        base.Init(contentManager);

            Score = 0;
            Health = 100;

            Weapon = WeaponType.Normal;

            base.Init(contentManager);
        }
        #endregion

        #region Update and Render
        public override void Update(GameTimerEventArgs gameTime)
        {
            // Update catapult related to the player
            Catapult.Update(gameTime);
            base.Update(gameTime);
        }

        public override void Draw(GameTimerEventArgs gameTime)
        {
            // Draw related catapults
            Catapult.Draw(gameTime);
            base.Draw(gameTime);
        }
        #endregion
    }
}
